﻿#region Using

using System.Collections.Generic;

using GameLogic.External;

using ServerApplication.Interfaces;

#endregion

namespace ServerApplication.GameSession
{
    public class GameWorker : IGameWorker
    {
        private readonly Dictionary<IGame, WorkItem> workItems = new Dictionary<IGame, WorkItem>();

        public void Deregister(IGame game)
        {
            this.workItems[game].Stop();
            this.workItems.Remove(game);
        }

        public void Register(IGame game)
        {
            this.workItems.Add(game, new WorkItem(game.Update));
        }
    }
}